import axios from 'axios';
import { Toast } from 'vant';
const http = axios.create({
    baseURL: 'https://m.maizuo.com',
    timeout: 5000,
    headers: {
        "X-Client-Info":
            '{"a":"3000","ch":"1002","v":"5.0.4","e":"16218464241254272184352769","bc":"110100"}',
        "X-Requested-With": "XMLHttpRequest",
        "X-Token": "",
    }
});
// Add a request interceptor
http.interceptors.request.use(function (config) {
    // Do something before request is sent
    Toast.loading({
        message: '加载中...',
        forbidClick: true,
      });
    return config;
  }, function (error) {
    Toast.clear();
    // Do something with request error
    return Promise.reject(error);
  });

// Add a response interceptor
http.interceptors.response.use(function (response) {
    // Do something with response data
    Toast.clear();
    return response;
  }, function (error) {
    Toast.clear();
    // Do something with response error
    return Promise.reject(error);
  });
export default http